<?php

function send_post($url, $post_data) {

  $postdata = http_build_query($post_data);
  $options = array(
    'http' => array(
      'method' => 'POST',
      'header' => 'Content-type:application/x-www-form-urlencoded',
      'content' => $postdata,
      'timeout' => 15 * 60 // ³¬Ê±Ê±¼ä£¨µ¥Î»:s£©
    )
  );
  $context = stream_context_create($options);
  print_r($context);
  $result = file_get_contents($url, false, $context);

  return $result;
}

  function post3($host,$path,$query,$others=''){//fsocket
 
 
        $post="POST $path HTTP/1.1\r\nHost: $host\r\n";
 
        $post.="Content-type: application/x-www-form-";
 
        $post.="urlencoded\r\n${others}";
 
        $post.="User-Agent: Dalvik/1.6.0 (Linux; U; Android 4.4.4; Nexus 4 Build/KTU84P)\r\nContent-length: ";
 
        $post.=strlen($query)."\r\nConnection: close\r\n\r\n$query";
        //echo strlen($query);
 
        $h=fsockopen($host,80);
        
 
        fwrite($h,$post);
 
        for($a=0,$r='';!$a;){
 
                $b=fread($h,1024);
                //echo $b;
 
                $r.=$b;
 
                $a=(($b=='')?1:0);
 
            }
             /*while (! feof ( $h )) {
       		 echo  fgets ( $h ,  128 );
    		}*/

 
        fclose($h);
 		//var_dump($r);
        return $r;
 
    }

$dt=array();
$dt['pid']='00300108:00300111:00300110:00300901';
$dt['appId']='A0008';
$dt['ed']='Q7nOj8auJb1ERB%2BK%2Fk2OTdxFmqRdMb6M0ZZYvUvK3TGOrlHgwcaAY%2BLAMvPMDoL4H%2FulIJAD6BhhxOB2hYT%2BdKWzvHiNVz8QyO3KZaayQ%2BJSyX0MSfPdU0f%2FzGlS2LWlh5F0E3pyPV8i2pNLLqTlpg%2B4uWDgwBIvzJY4VhMjHfwrrCbpLKT7gfndxMEff200a8V7ZQff%2BVdnSA7d2fE91qrn8bP%2BN4w3M9hfnUQ7Kwo2CLOFaOdY4meWU6lLSCjWwXptd5WBrQRm1TrU48XgrZsty33d3dTuanfP5cTh9KStaTmeDrYgdcdM87R0tsVA1Yf%2BJu0LlJ9DeOgLZcyxlwzigJsyh8cdbXUc95jxkYiXJxLxepLpRjKYQSEeX2FrkkeH8IL01y%2F%2B7uuWhZBM6aYk5I8UJ0gGJSQL30LHF4Vst%2F%2FPTBspFw70izt1GwXidILqYNZYZYwjMTva9IJjTomUUazZwOuJlXqcdCjISSVTmaYhmNEaumeDNoPr9Do4X1neKjxZffL%2Fu6cBxDiVmMHVF2Mn6YPh733xQaI%2FETH2leeNpt5uVwzZan%2BsFl8l8a1JZAgu9tOfoRBspzQJH0eAliAO7S1KZ3hMizeFknbLSntbNraWVVWOdENy3fnF0IhTtXn8REDWIL54m2dBZuNTsumgFo5fU03ZV8R0YKv3%2B6GvsT4%2B5EUFLQNYTK2B';
$dt['dhid']='c354f4228aa3493cb29a96ba092d20ae';
$dt['et']='a';
$dt['verCode']='3152';
$dt['sv']='1.0';
$dt['pv']='1.0';
$dt['st']='m';
$dt['sign']='3C255AD386FB1D4807AF7912731391D3';

$dd='pid=00300108:00300111:00300110:00300901&appId=A0008&ed=Q7nOj8auJb1ERB%2BK%2Fk2OTdxFmqRdMb6M0ZZYvUvK3TGOrlHgwcaAY%2BLAMvPMDoL4H%2FulIJAD6BhhxOB2hYT%2BdKWzvHiNVz8QyO3KZaayQ%2BJSyX0MSfPdU0f%2FzGlS2LWlh5F0E3pyPV8i2pNLLqTlpg%2B4uWDgwBIvzJY4VhMjHfwrrCbpLKT7gfndxMEff200a8V7ZQff%2BVdnSA7d2fE91qrn8bP%2BN4w3M9hfnUQ7Kwo2CLOFaOdY4meWU6lLSCjWwXptd5WBrQRm1TrU48XgrZsty33d3dTuanfP5cTh9KStaTmeDrYgdcdM87R0tsVA1Yf%2BJu0LlJ9DeOgLZcyxlwzigJsyh8cdbXUc95jxkYiXJxLxepLpRjKYQSEeX2FrkkeH8IL01y%2F%2B7uuWhZBM6aYk5I8UJ0gGJSQL30LHF4Vst%2F%2FPTBspFw70izt1GwXidILqYNZYZYwjMTva9IJjTomUUazZwOuJlXqcdCjISSVTmaYhmNEaumeDNoPr9Do4X1neKjxZffL%2Fu6cBxDiVmMHVF2Mn6YPh733xQaI%2FETH2leeNpt5uVwzZan%2BsFl8l8a1JZAgu9tOfoRBspzQJH0eAliAO7S1KZ3hMizeFknbLSntbNraWVVWOdENy3fnF0IhTtXn8REDWIL54m2dBZuNTsumgFo5fU03ZV8R0YKv3%2B6GvsT4%2B5EUFLQNYTK2B&et=a&dhid=c354f4228aa3493cb29a96ba092d20ae&verCode=3152&st=m&sign=3C255AD386FB1D4807AF7912731391D3&sv=1.0&pv=1.0';
$answer=post3("ap.51y5.net","/ap/fa.sec",$dd); //send_post('http://ap.51y5.net/ap/fa.sec',$dt);
var_dump($answer);
$js01=json_decode($answer);
var_dump($js01);












?>